package com.gis.controller;


import com.gis.result.ResponseResult;
import com.gis.service.IOrganismDataService;
import com.gis.vo.PublishVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bobo
 * @since 2024-11-02
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/organismData")
public class OrganismDataController {
    private final IOrganismDataService organismDataService;

    @GetMapping("/getLayer")
    public ResponseResult getOrgLayer(){
        List<PublishVO> orgPublishUrl = organismDataService.getOrgPublishUrl();
        return ResponseResult.success(orgPublishUrl);
    }

    @GetMapping("/publish")
    public ResponseResult publishLayer(String layerName){
        int success = organismDataService.publishLayer(layerName);
        if(success == 1)
            return ResponseResult.success();
        return ResponseResult.fail();
    }
}
